{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "乐学偶得版权所有  公众号：乐学Fintech  主讲人：William LX_LAB教研团队提供技术支持 正版视频： 网易云课堂：乐学偶得"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "13.数数，假设有一个容器，这个容器为list，现在需要你从这个容器里寻找数字8，并数一数一共有多少个8这样的数字？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "tips: 涉及到count的知识点，一般我们可以通过“计数器”的方法实现"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "def count_in_the_list(some_list_to_be_counted):\n",
    "    count = 0\n",
    "    for number in some_list_to_be_counted:\n",
    "        if number ==8:\n",
    "            count = count +1\n",
    "    return count\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8\n"
     ]
    }
   ],
   "source": [
    "print(count_in_the_list([1,2,3,4,5,6,7,8,8,8,8,8,8,8,8,9,10]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
